//
//  M4FaceFailAlertView.swift
//  M4
//
//  Created by YuChuang on 2024/8/15.
//

import UIKit

class M4FaceFailAlertView: UIView {

    @IBOutlet weak var M4FaceFailTitle: UILabel!
    
    @IBOutlet weak var M4FaceFailContent: UILabel!
    
    @IBOutlet weak var M4FaceFailButton: UIButton!
    
    @IBOutlet weak var M4FaceFailContentTop: NSLayoutConstraint!
    
    var M4FaceFailBlock: (() -> Void)?
    
    override func awakeFromNib() {
        self.frame = CGRect(x: 0, y: 0, width: M4ScreenWidth, height: M4ScreenHeight)
    }
    
    func M4FaceFailUpdateUI(title: String = "", content: String, buttonTitle: String) {
        M4FaceFailTitle.text = title
        M4FaceFailContentTop.constant = title == "" ? 0 : 8
        M4FaceFailContent.text = content
        M4FaceFailButton.setTitle(buttonTitle, for: .normal)
    }
    
    @IBAction func M4FaceFailButtonClick(_ sender: UIButton) {
        M4AlertViewHidden()
        M4FaceFailBlock?()
        sender.M4EventUnavailable = false
    }
    
}
